1) Field of the Invention
The present invention relates to a method for controlling a tape operation of a magnetic tape unit in response to a command from a command issuing apparatus (for example, a host computer/upper apparatus such as a CPU).
2) Description of the Related Art
With an increasing demand for higher-speed computer systems in recent years, there is a requirement for a more efficient backup/restore operation to copy data between a DASD (Direct Access Storage Device) and a magnetic tape.
In order to store large amounts of data on a magnetic tape at a high speed, there is provided a technique called streaming. The streaming is a process of successively performing READ or WRITE from/on a magnetic tape by buffering.
When an upper apparatus such as a CPU accesses to a magnetic tape via a magnetic tape controller having a data buffer, for example, the magnetic tape controller such controls that a read/write process between the upper apparatus and the buffer, and a read/write process between the buffer and the magnetic tape are carried out asynchronously to perform a streaming process.
As above, the streaming control (asynchronous control by buffering) is performed when successively reading/writing a data block on the magnetic tape unit, thereby lessening the frequency of the start/stop operation of the magnetic tape, thus improving the read/write performance of the magnetic tape unit.
When the upper apparatus issues a command to reverse the direction of travel of the magnetic tape, or when a tape mark is detected, or when the upper apparatus issues a command in the read/write control system while the magnetic tape unit carries out such the streaming, it is necessary to stop the streaming for a time to synchronize the process carried out on the channel's side connected to the upper apparatus with the process carried out on the magnetic tape unit's side.
With reference to FIGS. 175 through 201, a structure of a known magnetic tape controller and streaming process/command processing by the magnetic tape controller will be described hereinafter.
FIG. 175 is a block diagram showing a hardware structure of the magnetic tape controller. As shown in FIG. 175, a magnetic tape controller (MTC; Magnetic Tape Controller) 10 is disposed between a CPU 20 (host computer, upper apparatus) 20 and a magnetic tape unit (MTU; Magnetic Tape Unit) 30 to control operations of the MTU 30 in response to commands from the CPU 20.
The MTC 10 comprises a channel interface circuit 11, a data compressing circuit 12, a data decompressing circuit 13, a host interface controller (HIC; Host Interface Controller) 14, a format controller (FMT: ForMaT controller) 15, a command buffer 16 and a data buffer 17.
The channel interface circuit 11 controls a channel interface with the CPU 20. The data compressing circuit 12 performs data compression in, for example, EDRC (Enhanced Data Recording Capability) system. The data decompressing circuit 13 decompresses the compressed data.
The HIC 14 performs format conversions and controls in order to send/receive data with the CPU 20. The FMT 15 performs format conversions and controls in order to send/receive data with the MTU 30. The command buffer 16 is to communicate between the HIC 14 and the FMT 15, storing commands directing operations and the like that should be performed by the HIC 14 and the FMT 15. The data buffer 17 temporarily stores each block of data (write data) that should be written on the magnetic tape or data (read data) that has been read out from the magnetic tape as a unit.
The command buffer 16 comprises, as shown in FIG. 176, a command pointer table for HIC (HQP) 16-1, a command list table for HIC (HQL) 16-2, a command pointer table for FMT (FQP) 16-3 and a command list table for MFT (FQL) 16-4.
In the HQP 16-1, there are set a prefetch direction flag for urging the FMT 15 to perform preferentially a read operation or a read-back operation, a command pointer indicating a position of the latest command in the HQL 16-2, and a BID showing an ID (Identification: hereinafter abbreviated as BID) of the latest block in the data butter 17.
In the FQP 16-3, there are set a prefetch completion flag showing that the read operation or the read-back operation has been carried out preferentially in response to the prefetch direction and the preferential operation has been completed, a command pointer indicating a position of the latest command in the FQL 16-4, and the latest BID in the data buffer 17.
The data buffer 17 functions as an intermediate buffer between the HIC 14 and the FMT 15 when a reading or writing is performed. Namely, at the time of writing, the HIC 14 stores data transferred from the CPU 20 in the data butter 17, and the FMT 15 transfers the write data in the data buffer 17 to the MTU 30 and records the data on the magnetic tape. On the other hand, at the time of reading, the FMT 15 reads data on the magnetic tape from the MTU 30 and stores the data in the data buffer 17, and the HIC 14 transfers the read data in the data buffer 17 to the CPU 20.
The HQL 16-2 functions as a command queue for storing commands directing operations that should be carried out by the HIC 14 in response to directions from the CPU 20 (commands 1 to 3 in FIG. 176) in the order they were generated. In the HQL 16-2, there are recorded block pointers (BPNT) indicating positions in the data buffer 17 of data blocks (DATA 1 to DATA 3 in FIG. 176) corresponding to respective commands, block lengths (BLEN) of the data blocks, block IDs (BID) of the data blocks, etc.
The FQL 16-4 functions as a command queue storing commands having been carried out by the FMT 15 in accordance with the directions from the CPU 20 (commands 1 and 2 in FIG. 176) in the order their processes were completed. In the FQL 16-4, there are recorded block pointers (BPNT)-indicating positions in the data buffer 17 of data blocks (DATA 1 to DATA 3 in FIG. 176) corresponding to respective commands, block lengths (BLEN) of the data blocks, block IDs (BID) of the data blocks, flags (TM) each showing that a tape mark recorded on the magnetic tape has been detected in the MTU 30, etc.
In the FMT 15, information XBID about a block ID managed by the FMT 15 is stored in a register 15a. The XBID indicates a position of a head relative to the magnetic tape (ID of a data block at which the head is really positioned) in the MTU 30.
Next, operations of the MTC 10 structured as above will be described.
With reference to FIGS. 177 through 182, streaming sequences by the MTC 10 will be described.
[Read Streaming Sequence]
FIGS. 177 and 178 are diagrams for illustrating states of the command buffer 16 and the data buffer 17 when a read streaming sequence is executed.
In the MTC 10, when the channel interface circuit 11 receives a read command issued from the CPU 20, the HIC 14 sets a prefetch direction flag in the HQP 16-1. The FMT 15 has a look at the prefetch direction flag set in the HQP 16-1, makes the MTU 30 read a plurality of data blocks from the magnetic tape, writes the data in the data buffer 17, and registers command lists for the read blocks in the FQL 16-4.
In the MTU 30, a mechanical operation is such carried out that the head of the MTU 30 is moved in the forward direction relative to the magnetic tape MT, at this time. For instance, data blocks “DATA 1, DATA 2, DATA 3” are read in order. Here, the three data blocks are written in the data buffer 17. The number of data blocks to be preferentially read is set according to a capacity of the data buffer 17, for example, and the preferentially read operation is such controlled as to be halted when a quantity of the write data exceeds the capacity of the data buffer 17.
As shown in FIG. 177, commands “READ 1, READ 2, READ 3” corresponding to the respective data blocks written in the data buffer 17 are set in order in the command queue of the FQL 16-4.
A predetermined number (here, 3) of the data blocks are written in the data buffer 17 as in the above manner, the latest command pointer and the latest block ID are then stored in the FQP 16-3, and a prefetch completion flag is set as well.
After the prefetch completion flag is set in the FQP 16-3, the HIC 14 compares a value of the command pointer in the HQP 16-1 with a value of the command pointer in the FQP 16-3, and transfers a data block corresponding to a difference therebetween to the CPU 20. At this time, the HQP 16-1 and the HQL 16-2 are successively updated as shown in FIG. 178. Namely, each time a data block in the data buffer 17 is transferred to the CPU 20, a command having been executed is recorded in the FQL 16-2, the command pointer in the FQP 16-1 is updated and a block ID of the latest data block having been transferred is stored.
FIG. 178 depicts a state in which transfer (reading) of all the three data blocks to the CPU 20 is completed. In the state shown in FIG. 178, both the block IDs in the HQP 16-1 and the FQP 16-3 indicate an ID (for example, 3) of the third data block.
In data transfer to the CPU 20, if data read out from the magnetic tape has been compressed, the data is first inputted to the data decompressing circuit 13, then transferred to the CPU 20.
The MTC 10 can send read data to the channel to transfer the same to the CPU 20 in response to read commands successively issued from the CPU 20 after carrying out the above preferential read operation as long as read data exists in the data buffer 17, without any mechanical operation (real read operation) of the MTU 30. Accordingly, the MTU 30 is not required to perform the mechanical operation for each data block, so that the data transfer efficiency at the time of read operation is improved.
When the FMT 15 detects a tape mark during the read operation, a TM flag is set in the FQL 16-4.
[Write Streaming Sequence]
Next, description will be made of a case where the MTC 10 such controls the MTU 30 as to record predetermined data (data blocks “DATA 1”, “DATA 2”, “DATA 3”) on the magnetic tape according to directions from the CPU 20, with reference to FIGS. 179 and 180. FIGS. 179 and 180 are diagrams depicting states of the command buffer 16 and the data buffer 17 when a write streaming sequence is executed. Incidentally, the prefetch direction flag and prefetch completion flag are not set in the HQP 16-1 and the HQP 16-3, respectively, when a write operation is performed, as shown in FIGS. 179 and 180.
In the MTC 10, when the channel interface circuit 11 receives write commands issued from the CPU 20, the HIC 14 successively stores the write commands (WRITE 1, WRITE 2, WRITE 3) in the HQL 16-2, and registers the latest command pointer and the latest block ID in the HQP 16-1. The data blocks, “DATA 1”, “DATA 2” and “DATA 3”, are successively written in the data buffer 17 in response to the respective write commands.
When completing a writing of a predetermined number of data blocks (here, 3) in the data buffer 17, the HIC 14 stores the latest command pointer and the latest block ID in the HQP 16-1, and reports completion of the writing to the CPU 20.
Note that when intending to write data that should be written on the magnetic tape in a compressed form, that data is first inputted to the data compressing circuit 12 from the channel interface circuit 11 to be compressed in the EDRC system therein, then written in the data buffer 17.
On the other hand, the FMT 15 compares a value of the command pointer in the HQP 16-1 with a value of the command pointer in the FQP 16-3. When the FMT 15 detects that a difference therebetween is generated, the FMT 15 recognizes that commands are registered in the HQL 16-2, thus successively transfers data blocks corresponding to the difference from the data buffer 17 to the MTU 30 to store the data on the magnetic tape.
At this time, the FQP 16-3 and the FQL 16-4 are successively updated, as shown in FIG. 180. Namely, each time a data block in the data buffer 17 is transferred to the MTU 30 to be recorded in the magnetic tape, a command having been executed is recorded in the FQL 16-4, and the latest command pointer and the latest block ID are registered in the FQP 16-3.
FIG. 180 depicts a state in which a writing of the second data block “DATA 2” on the magnetic tape is completed. In the state shown in FIG. 180, a block ID in the HQP 16-1 indicates an ID (for example, 3) of the third data block, whereas a block ID in the HQP 16-3 indicates an ID (for example, 2) of the second data block.
As above, the MTC 10 stores write commands successively issued from the CPU 20 and data blocks that should be written on the magnetic tape in the HQL 16-2 and the data buffer 17, respectively, for a time, thereby processing the write commands asynchronously with the MTU 30.
Since the FMT 15 can perform a write streaming operation such as writing data on the magnetic tape when data blocks are accumulated to some extent in the data buffer 17, the frequency of execution of the start/stop operation of the MTU 30 is decreased, which increases a write performance of the MTU 30.
[Other Command Sequence]
FIGS. 181 and 182 are diagrams illustrating states of the command buffer 16 and the data buffer 17 when a command sequence other than a read command and a write command is executed.
Other than a read command and a write command, there are, for example, a read backward command (RB), a back space block command (BSP), a back space file command (BSPF), a forward space block command (SP) a forward space file command (FSPF) and a write tape mark command (WTM) as commands causing tape operations of the MTU 30.
When the CPU 20 issues such a command and the channel interface circuit 11 receives the command in the MTC 10, the HIC 14 registers the command in the HQL 16-2 and stores the latest command pointer in the HQP 16-1 as shown in FIG. 181.
On the other hand, the FMT 15 compares a value of the command pointer in the HQP 16-1 with a value of the command pointer in the FQP 16-3. When the FMT 15 detects that a difference is generated therebetween, the FMT 15 recognizes that a command is registered in the HQL 16-2, thus carries out a process according to the command (command processing), then registers the command in the FQL 16-4 and the latest command pointer in the FQP 16-3 as well, as shown in FIG. 182.
When the HIC 14 has a look at a difference between a value of the command pointer in the FQP 16-3 and a value of the command pointer in the HQP 16-1 and recognizes that the FMT 15 completes the command processing, the HIC 14 reports completion of the command processing to the CPU 20.
When processing a command other than a read command and a write command, the process is serially carried out without the streaming process as above, whereby a process (process by the HIC 14) on the channel's side connected to the CPU 20 is synchronized with a process (process by the FMT 15) on the side of the MTU 30.
Next, a command processing by the FMT 15 will be described with reference to FIGS. 183 through 199.
[Idle Process]
FIG. 183 is a flowchart (Steps S11 to S30) for illustrating an idle process by the FMT 15. As shown in FIG. 183, the FMT 15 periodically reads the HQP 16-1 of the command buffer 16 in the idle process to refer to it (Step S11).
When the prefetch direction flag is set in the HQP 16-1 (YES route at Step S12), it is determined whether or not a command corresponding to the prefetch direction flag is a read command (RD command) (Step S22). When the command is an RD command (YES route at Step S22), the FMT 15 executes a read process (RD process) while referring to FIGS. 184 and 185 (Step S23), and goes back to Step S11. When the command is not an RD command (NO route at Step S22), the FMT 15 executes a read backward process (RB process) to be described later while referring to FIGS. 186 and 187 (Step S24), then goes back to Step S11.
On the other hand, when the prefetch direction flag is not set in the HQP 16-1 (NO route at Step S12), the FMT 15 compares a value of the command pointer in the HQP 16-1 with a value of the command pointer in the FQP 16-3 (Step S13). When [a value of the command pointer in the HQP 16-1] is not larger than [a value of the command pointer in the FQP 16-3] (NO route at Step S13), the FMT 15 determines that a command to be processed is not registered in the command buffer 16, and goes back to Step S11.
When it is determined that [a value of the command pointer in the HQP 16-1] is larger than [a value of the command pointer in the FQP 16-3] (YES route), the FMT 15 refers to the HQL 16-2 (Step S14), and determines a type of the command registered in the HQL 16-2 (Steps S15 to S20).
Namely, when the command is a write command (WR command) (YES route at Step S15), the FMT 15 executes a write process (WR process) to be described later while referring to FIGS. 188 and 189 (Step S25), then goes back to Step S11.
When the command is a back space block command (BSP command) (from NO route at Step S15 to YES route at Step S16), the FMT 15 executes a back space block process (BSP process) to be described later while referring to FIGS. 190 and 191 (Step S26), then goes back to Step S11. When the command is a back space file command (BSPF command) (from NO route at Step S16 to YES route at Step S17), the FMT 15 executes a back space file process (BSPF process) to be described later while referring to FIGS. 192 and 193 (Step S27), then goes back to Step S11.
When the command is a forward space block command (SP command) (from NO route at Step S17 to YES route at Step S18), the FMT 15 executes a forward space block process (SP process) to be described later while referring to FIGS. 194 and 195 (Step S28), then goes back to Step S11. When the command is a forward space block command (FSPF command) (from NO route at Step S18 to YES route at Step S19), the FMT 15 executes a forward space file process (FSPF process) to be described later while referring to FIGS. 196 and 197 (Step S29), then goes back to Step S11.
When the command is a write tape mark command (WTM command) (from NO route at Step S19 to YES route at Step S20), the FMT 15 executes a write tape mark process (WTM process) to be described later while referring to FIGS. 198 and 199 (Step S30), then goes back to Step S11.
When the command is not a WTM command (NO route at Step S20), the FMT 15 executes a process according to the command (other command processing) (Step S21), then goes back to Step S11.
[Read Process (RD Process)]
FIG. 184 is a flowchart for illustrating a read process by the FMT 15. FIG. 185 is a diagram in which a part of the flowchart shown in FIG. 184 (processes A1, B1 and C1) is tabulated in order to explain the read process by the FMT 15.
As shown in FIGS. 184 and 185, process A1, process B1 and process C1 are repeatedly executed at the time of the RD process by the FMT 15 until the streaming is stopped.
In the process A1, the FMT 15 makes the MTU 30 execute a read operation according to the RD command, besides updating XBID by adding 1 to XBID registered in the register 15a. 
In the process B1, the FMT 15 determines whether or not a tape mark is read out in the read operation by the MTU 30 executed in the process A1 (Step S31). When a tape mark (TM) is read out (YES route at Step S31), the FMT 15 sets a TM flag and sets “0” as the block length BLEN (Step S32), and sets XBID as BID (Step S34). On the other hand, when data other than the tape mark (TM) is read out (NO route at Step S31), the FMT 15 clears the TM flag and sets “LEN” as the block length BLEN (Step S33), then reads XBID as BID from the register 15a and sets the same (Step S34). Here, “LEN” is a block length set in a hard register after the data is transferred from the MTU 30 to the data buffer 17.
In the process C1, the FMT 15 registers BID, BLEN and TM flag obtained in the process B1 in the FQL 16-4 in the command buffer 16, registers a value obtained by adding BLEN to BPNT of the next command ahead as a block pointer BPNT, and updates the command pointer and BID in the FQP 16-3.
[Read Backward Process (RB Process)]
FIG. 186 is a flowchart for illustrating a read backward process by the FMT 15. FIG. 187 is a diagram in which the flowchart (processes A2, B2 and C2) shown in FIG. 186 is tabulated in order to explain the read backward process by the FMT 15.
As shown in FIGS. 186 and 187, the process A2, the process B2 and the process C2 are executed at the time of the RB process by the FMT 15.
In the process A2, the FM 15 makes the MTU 30 execute a back read operation according to the RB command, and updates XBID by subtracting 1 from XBID registered in the register 15a. 
In the process B2, the FMT 15 determines whether or not a tape mark is read out in the real back read operation by the MTU 30 executed in the process A2 (Step S41) as does, in the RD process. When the tape mark (TM) is read out (YES route at Step S41), the FMT 15 sets a TM flag along with “0” as a block length BLEN (Step S42), and sets XBID as BID (Step S44). On the other hand, when data other than the tape mark (TM) is read out (NO route at Step S41), the FMT 15 clears the TM flag, sets “LEN” as the block length BLEN (Step S43), then reads out XBID as BID from the register 15a and sets the same (Step S44). Here, “LEN” is a block length to be set in the hard register after data is transferred from the MTU 30 to the data buffer 17.
In the process C2, the FMT 15 registers the BID, BLEN and TM flag obtained in the process B2 in the FQL 16-4 in the command buffer 16 as does in the RD process, registers a value obtained by adding BLEN to BPNT of the next command ahead as a block pointer BPNT, and updates the command pointer and BID in the FQP 16-3.
[Write Process (WR Process)]
FIG. 188 is a flowchart for illustrating a write process by the FMT 15. FIG. 189 is a diagram in which a part (processes A3, B3 and C3) of the flowchart shown in FIG. 188 is tabulated in order to explain the write process by the FMT 15.
As shown in FIGS. 188 and 189, the process A3, the process B3 and the process C3 are repeatedly executed at the time of the WR process by the FMT 15 until the streaming is stopped (until judged YES at Step S50).
In the process A3, the FMT 15 makes the MTU 30 execute a write operation according to a WR command, and updates XBID by adding 1 to XBID registered in the register 15a. 
In the process B3, the FMT 15 sets “LEN” as a block length BLEN, reads XBID as BID from the register 15a and sets the same. Here, “LEN” is a block length to be set in the hard register after data is transferred from the CPU 20 to the data buffer 17.
In the process C3, the FMT 15 registers the BID and BLEN obtained in the process B3 in the FQL 16-4 in the command buffer 16, registers a value as a block pointer BPNT obtained by adding BLEN to BPNT of the next command ahead, and updates the command pointer and BID in the FQP 16-3.
[Back Space Block Process (BSP Process)]
FIG. 190 is a flowchart for illustrating aback space block process by the FMT 15. FIG. 191 is a diagram in which the flowchart (processes A4, B4 and C4) shown in FIG. 190 in order to explain a back space block process by the FMT 15.
As shown in FIGS. 190 and 191, the process A4, the process B4 and the process C4 are executed at the time of the BSP process by the FMT 15.
In the process A4, the FMT 15 makes the MTU 30 execute a back space operation (operation to move a position of the head backward by one data block relative to the magnetic tape) according to a BSP command, and updates XBID by subtracting 1 from XBID registered in the register 15a. 
The FMT 15 reads XBID as BID from the register 15a and sets the same in the process B4. In the process C4, the FMT 15 registers the BID obtained in the process B4 in the FQL 16-4 in the command buffer 16, and updates the command pointer and BID in the FQP 16-3.
[Back Space File Process (BSPF Process)]
FIG. 192 is a flowchart for illustrating a back space file process by the FMT 15. FIG. 193 is a diagram in which a part (processes A5, B5 and C5) of the flowchart shown in FIG. 192 is tabulated in order to explain the back space file process by the FMT 15.
As shown in FIGS. 192 and 193, the process A5 and the process B5 are repeatedly executed at the time of the BSPF process by the FMT 15 until a tape mark (TM) is detected (until judged YES at Step S51). When a TM is detected (YES route at Step S51), the process C5 is executed.
In the process A5, the FMT 15 makes the MTU 30 execute a back space operation (operation to move a position of the head backward for one data block relative to the magnetic tape) according to the BSPF command, and updates XBID by subtracting 1 from XBID registered in the register 15a. Thereafter, the FMT 15 reads XBID as BID from the register 15a and sets the same in the process B5. By repeating the processes A5 and B5, the magnetic tape is driven backward until a position of the head relative to the magnetic tape reaches a position of the nearest TM (a position at the end of the file).
In the process C5, the FMT 15 registers the BID obtained in the process B5 in the FQL 16-4 in the command buffer 16, and updates the command pointer and BID in the FQP 16-3.
[Forward Space Block Process (SP Process)]
FIG. 194 is a flowchart for illustrating a forward space block process by the FMT 15. FIG. 195 is a diagram in which the flowchart (processes A6, B6 and C6) shown in FIG. 194 is tabulated in order to explain the forward space block process by the FMT 15.
As shown in FIGS. 194 and 195, the process A6, the process B6 and the process C6 are executed at the time of an SP process by the FMT 15.
In the process A6, the FMT 15 makes the MTU 30 execute a forward space operation (operation to move a position of the head forward by one data block relative to the magnetic tape) according to an SP command, and updates XBID by adding 1 to XBID registered in the register 15a. 
In the process B6, the FMT 15 reads XBID as BID from the register 15a and sets the same. In the process C6, the FMT 15 registers BID obtained in the process B6 in the FQL 16-4 in the command buffer 16, and updates the command pointer and BID in the FQP 16-3.
[Forward Space File Process (FSPF Process)]
FIG. 196 is a flowchart for illustrating a forward space file process by the FMT 15. FIG. 197 is a diagram in which a part (processes A7, B7 and C7) of the flowchart shown in FIG. 196 is tabulated in order to explain the forward space file process by the FMT 15.
As shown in FIGS. 196 and 197, the process A7 and the process B7 are repeatedly executed at the time of the FSPF process by the FMT 15 until a tape mark (TM) is detected (until judged YES at Step S51). When a TM is detected (YES route at Step S52), the process C7 is executed.
In the process A7, the FMT 15 makes the MTU 30 execute a forward space operation (operation to move a position of the head forward by one data block relative to the magnetic tape) according to an FSPF command, and updates XBID by adding 1 to XBID registered in the register 15a. Thereafter, the FMT 15, in the process B7, reads XBID as BID from the register 15a, and sets the same. By repeating these processes A7 and B7, the magnetic tape is driven forward until a position of the head relative to the magnetic tape reaches a position of the nearest TM (position at the head of the file).
In the process C7, the FMT 15 registers the BID obtained in the process B7 in the FQL 16-4 in the command buffer 16, and updates the command pointer and BID in the FQP 16-3.
[Write Tape Mark Process (WTM Process)]
FIG. 198 is a flowchart for illustrating a write tape mark process by the FMT 15. FIG. 199 is a diagram in which the flowchart (processes A8, B3 and C8) shown in FIG. 198 is tabulated in order to explain the write tape mark process by the FMT 15.
As shown in FIGS. 198 and 199, the process A8, the process B8 and the process C8 are executed at the time of the WTM process by the FMT 15.
In the process A8, the FMT 15 makes the MTU 30 execute a write table mark operation (operation to write a tape mark on the magnetic tape) according to a WTM command, and updates XBID by adding 1 to XBID registered in the register 15a. 
In the process B8, the FMT 15 sets a TM flag, reads XBID as BID from the register 15a and sets the same. In the process C8, the FMT 15 registers the BID and TM flag obtained in the process B8 in the FQL 16-4 in the command buffer 16, and updates the command pointer and BID in the FQP 16-3.
FIGS. 200(A) and 200(B) are diagrams for illustrating a state of data writing on the magnetic tape, commands issued from the CPU 20 when a process of additionally writing a multi-file is carried out, and tape operations in the MTU 30 in response to the commands.
FIG. 200(A) depicts a state of data writing on the magnetic tape MT immediately after a writing of a file consisting of a plurality of data blocks (data 1 in the drawing) on the magnetic tape MT is completed. FIG. 200(B) depicts a state of data writing on the magnetic tape MT after a file consisting of a plurality of data blocks (data 2 in the drawing) is additionally written in the state shown in FIG. 200(A).
In FIGS. 200(A) and 200(B), each arrow indicates a tape operation (a direction and a quantity of movement of the head H relative to the magnetic tape MT) carried out in response to each command from the CPU 20. Each arrow is given a type of command (capital letters) directing execution of the tape operation indicated by the arrow. Further, the types of the commands are given numbers in parentheses, (1) to (24), arranged in order the commands were issued from the CPU 20. In FIGS. 200(A) and 200(B), the rightward direction signifies a forward direction of the tape, whereas the leftward direction signifies a backward direction of the same.
As shown in FIG. 200(A), after the last data block (data 1 in the drawings) of a certain file is written on the magnetic tape MT in response to a WR command [cf. (1)], a close process [cf. (2) to (7)] for the file is carried out. Namely, a tape mark TM-a is written on the magnetic tape MT in response to a WTM command [cf. (2)], two end-of-file labels (hereinafter abbreviated as EOF; EOF1, EOF2 in the drawings) are successively written on the magnetic file MT according to a WR command [cf. (3), (4)], two tape marks, TM-b and TM-c, are successively written on the magnetic tape in response to WTM commands [cf. (5), (6)], and the magnetic tape MT is moved backward until TM-b is detected by the head H in response to a BSPF command [cf. (7)]. The MTU 30 waits in a state in which the head H is located between the last two tape marks, TM-b and TM-c, after writing the file.
When the CPU 20 additionally write the second file on the magnetic tape in which the file has been written as shown in FIG. 200(A), an open process [cf. (8) to (22)] for the second file is carried out. Incidentally, it is assumed that an OS (Operating System) actuated by the CPU 20 reads EOF1 twice so as to recognize it, thereby issuing a command such as to recognize a position at which the second file should be additionally written, in the open process at the time of data writing.
In the file open process at the time of data writing, the magnetic tape MT is moved until TM-b is detected by the head H in response to a BSPF command [cf. (8)], then moved backward until TM-a is detected by the head H so as to skip EOF1 and EOF2 in response to a BSPF command [cf. (9)]. Thereafter, the magnetic tape is moved forward until TM-a is detected by the head H in response to an FSPF command [cf. (10)]. After EOF1 is once read in response to an RD command, the magnetic tape is moved forward until TM-b is detected by the head H so as to skip EOF 2 in response to an FSPF command [cf. (12)]. When TM-c is read in response to an RD command [cf. (13)], a Unit Exception report is made.
As shown in FIGS. 200(A) and 200(b), processes [cf. (14) to (19)] similar to those described above (7) to (12) are again carried out, the second reading of EOF 1 is completed, the head H is located between TM-b and TM-c, the tape mark TM-c is overwritten with two headers (hereinafter abbreviated as HDR; HDR1, HDR2 in the drawing) by successively writing the same on the magnetic tape MT in response to WR commands [cf. (20), (21)]. Further, the tape mark TM-d is written on the magnetic tape MT in response to a WTM command [cf. (22)], the file open process is thereby completed. Thereafter, a plurality of data blocks (data 2 in the drawing) belonging to the second file are successively written in response to WR commands [cf. (23), (24)]
FIG. 201 is a diagram for illustrating a state of data writing on the magnetic tape MT, commands issued from the CPU 20 when data is read out from two successive files, and tape operations in the MTU 30 in response to the commands.
FIG. 201 shows a state of data writing on the magnetic tape MT after two files are successively written in the manner as described above with reference to FIGS. 200(A) and 200(B).
In FIG. 201, each arrow indicates a tape operation (a direction and a quantity of movement of the head H relative to the magnetic tape MT) performed in response to each command from the CPU 20. Each arrow is given a type (capital letters) of command directing execution of a tape operation indicated by the arrow. The types of the commands are given numbers in parentheses (1) to (13) in order the commands were issued from the CPU 20. In FIG. 201, the rightward direction signifies a tape forward direction (forward), whereas the leftward direction signifies a tape backward direction (backward), as well.
As shown in FIG. 201, after the last data block (data 1 in the drawing) of the first file is read out from the magnetic tape MT in response to an RD command [cf. (1)], a close process [cf. (2), (3)] for the first file is carried out. Namely, the magnetic tape MT is moved forward in response an FSPF command [cf. (2)] until TM-a is detected by the head H, and moved forward according to an FSPF command [cf. (3)] until TM-b is detected by the head H so as to skip EOF1 and EOF2. The head H is thereby located at the leading position of the second file (between TM-b and HDR 1).
Next, the open process [cf. (4) to (11)] for the second file is executed. Incidentally, the OS (Operation System) actuated by the CPU 20 reads EOF 1 once to recognize the same, thereby issuing a command so as to recognize a position at which the second file is read out in the file open process at the time of data reading.
In the file open process at the time of data reading, the magnetic tape MT is moved backward until TM-b is detected by the head H in response to a BSPF command [cf. (4)], and moved backward until TM-a is detected by the head H to skip EOF1 and EOF 2 in response to a BSPF command [cf. (5)]. The magnetic tape MT is then moved forward until TM-a is detected by the head H in response to an FSPF command [cf. (6)] so as to read EOF 1 in response to an RD command [cf. (7)], and moved forward until TM-b is detected by the head H so as to skip EOF 2 in response to an FSPF command [cf. (8)], and two headers, HDR1 and HDR 2, are successively read according to RD commands [cf. (9), (10)]. Further, the magnetic tape MT is moved forward until TM-d is detected by the head H in response to an FSPF command [cf. (11)], the file open process is thereby completed. Thereafter, a plurality of data blocks (data 2 in the drawing) belonging to the second file are successively read according to RD commands [cf. (12), (13)].
In the MTU 30, when data blocks are successively written or read, the streaming control (asynchronous control by buffering) by the MTC 10 can lessen the frequency of the start/stop operation of the magnetic tape, thus improving the read/write performance, as described above.
However, when a tape mark is detected during the streaming operation or a tape operation according to a command (for example, SP command, BSPF command or the like) other than the RD command and the WR command, it is necessary to temporarily stop the tape operation (streaming operation) by the MTU 30, then carry out a re-position operation for a position of the head relative to the magnetic tape when the next command is executed to synchronize a process (process by the HIC 14) on the channel's side connected to the CPU 20 with a process (process by the FMT 15) on the side of the MTU 30.
For instance, a magnetic tape on which data has been recorded in the multi-file form includes a lot of tape mark blocks. When the streaming process is carried out on such a magnetic tape, the start/stop operation of the magnetic tape is carried out each time a tape mark is detected.
Particularly, on such the magnetic tape, the close/open process as described above with reference to FIGS. 200(A), 200(B) and 201 is carried out for the file, the end (a part including two tape marks, TM-a and TM-b, and two EOFs, EOF1 and EOF2) of the file on the magnetic tape MT is moved back and forth relative to the head H in response to commands from the CPU 20. For this reason, the frequency of the start/stop operation of the magnetic tape is increased, thus throughput of the job by the CPU 20 is noticeably decreased.
In the file open process, the OS of the CPU 20 reads EOF1 at least once to recognize it in order to accurately confirm a position at which the second file is additionally written or read, as described above.
Some type of the MTU 30 has a low accuracy of positioning of the head relative to the magnetic tape MT, while some type of the MTU 30 has a high accuracy of positioning of the head relative to the magnetic tape MT. Such the type having a high accuracy is not required to read/recognize EOF1 (or EOF2) in every occasion. In other words, the MTU 30 having a low accuracy (reliability) of positioning of the head is required to perform all the open process for a file as described above with reference to FIGS. 200(A), 200(B) and 201, but the MTU 30 having a high accuracy (reliability) of positioning of the head is not required to perform all the open process for a file.
It is possible that the CPU 20 such controls as to switch a command according to a type of the MTU 30 in order to issue a different command depending on the type of the MTU 30. In such case, it would be necessary to modify the OS and the like actuated by the CPU 20, in addition, a load of the processing on the CPU 20 would increase, which are undesirable.
In consequence, it is desirable to increase a speed of the file open/close process by not only the MTU 30 having a high accuracy of positioning of the head by but also the MTU 30 having a low accuracy of positioning of the head without modifying a command (OS and the like) issued from the side of the CPU 20 at the time of the file close/open process in order that the CPU 20 may cope with even the MTU 30 having a low accuracy of positioning of the head.